package com.cncytech.uiautomator_demo.testcase;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

import com.cncytech.uiautomator_demo.BaseTest;
import com.cncytech.uiautomator_demo.TestConstant;
import com.cncytech.uiautomator_demo.RetryWatcher;
import com.cncytech.uiautomator_demo.utils.Describe;

import org.junit.Rule;
import org.junit.Test;

/**
 * 麦克风测试
 */
public class MicrophonePoliciesTest extends BaseTest {
    @Rule
    public RetryWatcher retryWatcher = new RetryWatcher(TestConstant.retryCount);

    @Test
    @Describe(TestConstant.MICROPHONEPOLICIES_FORBIDDEN)
    public void microphoneForbiddentTest() {
        String msg = TestConstant.MICROPHONEPOLICIES_FORBIDDEN + TestConstant.FAILURE;
        int status = 0;
        assertThat(msg, hmm.setMicrophonePolicies(status));
        int microphonePolicies = hmm.getMicrophonePolicies();
        assertThat(msg, microphonePolicies, is(status));
    }

    @Test
    @Describe(TestConstant.MICROPHONEPOLICIES_ENABLE)
    public void microphoneEnableTest() {
        String msg = TestConstant.MICROPHONEPOLICIES_ENABLE + TestConstant.FAILURE;
        int status = 1;
        assertThat(msg, hmm.setMicrophonePolicies(status));
        int microphonePolicies = hmm.getMicrophonePolicies();
        assertThat(msg, microphonePolicies, is(status));
    }
}
